<table>
    <tr><th>Campaign</th><th>Start Date</th><th>End Date</th><th>Team</th><th>Team Goal</th><th>My Achievement</th></tr>

    <?php foreach ($data as $key => $value) : ?>
        <tr class="orderRow">
            <td><a href="javascript:void(0);" id="campaign_<?php echo $key;?>"><?php echo $value['campaign_title']; ?></a></td>
            <?php 
                $start = explode('T', $value['start_time']);
                $end = explode('T', $value['end_time']);
            ?>
            <td><?php echo $start[0]; ?></td>
            <td><?php echo $end[0]; ?></td>
            <td><?php echo $value['team']['title']; ?></td>
            <td><?php echo '$'.$value['team']['goal']; ?></td>
            <td><?php echo '$'.$value['amount_money']; ?></td>
        </tr>
        <?php foreach ($value['product_list'] as $item) : ?>
            <tr class="productList campaign_<?php echo $key;?>">
                <td></td>
                <td></td>
                <td><a href="javascript:void(0);" id="<?php echo $key.'_'.$item['nid'];?>"><?php echo $item['title']; ?></td>
                <td><?php echo '$'.($item['cost'] + $item['price']); ?></td>
                <td><?php echo $item['qty']; ?></td>
                <td><?php echo '$'.($item['cost'] + $item['price'])*$item['qty']; ?></td>
            </tr>
            <?php foreach ($item['purchase_details'] as $info):?>
                <tr class="purchaseDetails <?php echo $key.'_'.$item['nid'];?>">
                    <td></td>
                    <td></td>
                    <td></td>
                    <td><?php echo $info['user']->name ?></td>
                    <td><?php echo $info['qty'] ?></td>
                    <td><?php echo date('Y-m-d',$info['date']);?></td>
                    
                </tr>
            <?php endforeach;?>
        <?php endforeach; ?>
    <?php endforeach; ?>
</table>

<?php echo $pager; ?>

